package com.cqc.other.juc.synchronize.demo2;

import java.util.concurrent.TimeUnit;

/**
 * @author cui
 * @date 2025/6/25 22:13
 * @description
 **/
public class DataEntity {


    private static int count;

    public static synchronized void add() {
        for (int i = 0; i < 3; i++) {
            try {
                System.out.println("threadName:" + Thread.currentThread().getName() + ":" + count++);
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public int getCount() {
        return count;
    }
}
